#include <bits/stdc++.h>
using namespace std;
template <typename T>
class NamedObject
{
public:
    NamedObject(std::string &name, const T &value) : nameValue(nameValue), objectValue(value){};
    //To support copy assignment in a class containing a reference member, you must define the copy assignment operator yourself.
    // NamedObject &operator=(NamedObject &rhs){
    //         nameValue = rhs.nameValue;
    //         objectValue =  rhs.objectValue;
    // }

    std::string &nameValue;
    int objectValue;
};

int main()
{
    std::string newDog("Persephone");
    std::string oldDog("Satch");
    NamedObject<int> p(newDog, 2);
    NamedObject<int> s(oldDog, 36);
    // p = s;  //Error,C++ doesn’t provide a way to make a reference refer to a different object
    cout << p.nameValue << " " << endl;
}